﻿using Swashbuckle.AspNetCore.SwaggerGen;
using Yyd.DependencyInjection;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class YydSwaggerGenOptionsExtensions
    {
        /// <summary>
        /// 尝试添加 IncludeXml
        /// </summary>
        /// <param name="swaggerGenOptions"></param>
        /// <param name="includeControllerXmlComments"></param>
        public static void TryIncludeXmlComments(
            this SwaggerGenOptions swaggerGenOptions,
            bool includeControllerXmlComments = false)
        {
            foreach (var filePath in SwashbuckleConventionalRegistrar.FilePaths)
            {
                swaggerGenOptions.IncludeXmlComments(filePath, includeControllerXmlComments);
            }
        }
    }
}
